package comunication;

import jade.core.AID;
import jade.core.Agent;
import jade.util.leap.Serializable;

public abstract class Message implements Serializable{
	
	protected MessageType type;
	
	protected String ID;
	protected AID aid;
	protected String mail;

	public Message(Agent agent, String ID, MessageType type) {
		this.aid = agent.getAID();
		this.ID = ID;
		this.type = type;
	}
	
	public String getID() {
		if(ID==null)
			return "-";
		return this.ID;
	}
	
	public void setID(String iD) {
		this.ID = iD;
	}
	
	public MessageType getType(){
		return this.type;
	}
	
	public void setType(MessageType type){
		this.type = type;
	}
	
	public AID getAid() {
		return aid;
	}
	
	public void setAid(AID aid) {
		this.aid = aid;
	}
	
	public void setMail(String mail) {
		this.mail = mail;
	}
	
	public String getMail() {
		if(mail==null)
			return "-";
		return mail;
	}
	
	@Override
	public String toString() {
		return this.ID;
	}
}
